import http from "@/utils/http";

export const createScenicSpotAPI = (
  id: string,
  name: string,
  pictureUrl: string,
  description: string
) => {
  return http({
    url: "/api/v1/scenicSpot/create",
    method: "POST",
    data: {
      id,
      name,
      pictureUrl,
      description,
    },
  });
};

export const updateScenicSpotAPI = (
  id: string,
  name: string,
  pictureUrl: string,
  description: string
) => {
  return http({
    url: "/api/v1/scenicSpot/update",
    method: "POST",
    data: {
      id,
      name,
      pictureUrl,
      description,
    },
  });
};

export const deleteScenicSpotAPI = (id: string) => {
  return http({
    url: "/api/v1/scenicSpot/delete",
    method: "DELETE",
    params: {
      id,
    },
  });
};

export const searchSingleScenicSpotAPI = (id: string) => {
  return http({
    url: "/api/v1/scenicSpot/query",
    method: "GET",
    params: {
      id,
    },
  });
};

export const searchAllScenicSpotAPI = (page: number, pageSize: number) => {
  return http({
    url: "/api/v1/scenicSpot/queryByPage",
    method: "GET",
    params: {
      page,
      pageSize,
    },
  });
};

export const uploadImageAPI = (data: FormData) => {
  return http({
    url: "/api/v1/scenicSpot/uploadImg",
    method: "POST",
    data,
  });
};

export const showImageAPI = (imgUrl: string) => {
  return http({
    url: "/api/v1/scenicSpot/showImg",
    method: "GET",
    params: {
      imgUrl,
    },
  });
};
